<template>
	<view  class="uni-container">
	
			<view  class="uni-panel-h" v-for="(item ,index) in biomass"
				@click="goDetailPage(item)">
				<text class="uni-panel-text">{{getinfo(item)}}</text>
				<text class="uni-panel-icon uni-icon">&#xe470;</text>
			</view>
		
	</view>
</template>

<script>
	import {
		getInfo,
		setInfo
	} from '@/core/unicommon/storyageInfo.js'
	export default {
		data() {
			return {
				biomass:[],
			  grasstype:true,
			  inkey:"zwmc"
			}
		},
		onLoad(e){
			
		if(e && e.data){
			let data=JSON.parse(decodeURIComponent(e.data))	
			console.log("b",data)
			getInfo("userdata").then(res=>{
				this.biomass=res.data.biomass.filter(t=>t.ydNumber==data.ydNumber&& t.yfNumber==data.yfNumber)
				let yd=res.data.yd.find(t=>t.ydNumber==data.ydNumber)
				console.log(yd)
				if(yd.grasslandType!="人工草地"){
					this.grasstype=false
					this.inkey="ysz1"
					
				}else{
					this.grasstype=true
					this.inkey="zwmc"
					
				}
				console.log("ffff",res.data,this.biomass)
			})
		}	
		},
		methods: {
			getinfo(item){
				console.log(item,item[this.inkey],this.inkey)
				return item[this.inkey]
			},

			goDetailPage(item){
				if(this.grasstype){
					uni.navigateTo({
						url: "/pages/sampleplot/samplesquare/artificialBiomass?data="+ encodeURIComponent(JSON.stringify(item))
					})
				}else{
					uni.navigateTo({
						url: "/pages/sampleplot/samplesquare/natureBiomass?data="+ encodeURIComponent(JSON.stringify(item))
					})
				}
			}
		}
	}
</script>

<style scoped>
@import '@/common/uni-nvue.css';
</style>
